//
// Created by zuo on 2024/7/4.
// 题目链接 https://www.lanqiao.cn/problems/152/learning/?page=1&first_category_id=1&problem_id=152
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ll n;
    ll a, b, c;
    cin >> n;
    cin >> a >> b >> c;
    ll sum;
    for (int i = 1; i <= n; i++)
    {
        if (i % a != 0 && i % b != 0 && i % c != 0)
        {
            sum += 1;
        }
    }
    cout << sum << endl;

    return 0;
}
